console.log('\'Allo \'Allo!');
// var vConsole = new VConsole();
console.log('Hello world');

let shareData = {
  title: 'DESCENTE迪桑特—“星”动同款',
  desc: '群星争相演绎，LONG DOWN统领寒冬',
  link: location.href.split('#')[0],
  imgUrl: $('#share_img').prop('src')
};

var move = {
  center: {x: '0%', y: '0%', z: '0%'},
  top: {x: '0%', y: '-100%', z: '0%'},
  left: {x: '-100%', y: '0%', z: '0%'},
  right: {x: '100%', y: '0%', z: '0%'},
  bottom: {x: '0%', y: '100%', z: '0%'},
  leftTop: {x: '-100%', y: '-100%', z: '0%'},
  rightBottom: {x: '100%', y: '100%', z: '0%'}
};

$(function () {

  var loader = new resLoader({
    resources: [
      'images/DANIEL_H5_BG.gif',
    ],
    onStart: function (total) {
      console.log('start:' + total)
    },
    onProgress: function (current, total) {
      console.log(current + '/' + total);
      var percent = current / total * 100;
      $('.progressbar').css('width', percent + '%');
      // $('.progresstext .current').text(current);
      $('.progresstext .current').text(Math.floor(percent) + '%');
      // $('.progresstext .total').text(total);
      if (percent === 100) {

      }
    },
    onComplete: function (total) {
      console.log('加载完毕：' + total + '个资源');
      $('#load').fadeOut();
    }
  });
  // if ($('#load img').get(0).complete) {
  //   setTimeout(function () {
  //     $('#load').fadeOut()
  //   }, 1000);
  // } else {
  //   $('#load img').on('load', function () {
  //     setTimeout(function () {
  //       $('#load').fadeOut()
  //     }, 1000);
  //
  //   });
  // }

  loader.start();

  var daniel_ani = null,
    kol_ani = null;

  var daniel = new Swiper('.swiper-container.daniel', {
    loop: true,
    lazy: true,
    observer: true,
    observeParents: true,
    navigation: {
      nextEl: '.swiper-button-next1',
      prevEl: '.swiper-button-prev1',
    },
  });
  var kol = new Swiper('.swiper-container.kol', {
    loop: true,
    lazy: true,
    observer: true,
    observeParents: true,
    navigation: {
      nextEl: '.swiper-button-next2',
      prevEl: '.swiper-button-prev2',
    },
  });


  $('.btn1').click(function () {
    $('#daniel_waterfall img').each(function () {
      var src = $(this).attr('src');
      if (!src) {
        src = $(this).data('src');
        $(this).attr('src', src)
      }
    });
    $('#body').hide();
    $('#daniel_waterfall').show();
    daniel_ani = playDanielGroupAnimation()
    // var daniel_waterfall = playGroup2Animation();
    // daniel_waterfall.play();
    // daniel_waterfall.add(function () {
    //     // daniel_waterfall.seek(1);
    //     // daniel_waterfall.kill();
    //     daniel_waterfall.play(0)
    //
    // }, 'end+=1')

  });
  // $('.btn1').click();
  $('.btn2').click(function () {
    $('#kol_waterfall img').each(function () {
      var src = $(this).attr('src');
      if (!src) {
        src = $(this).data('src');
        $(this).attr('src', src)
      }
    });
    $('#body').hide();
    $('#kol_waterfall').show();
    kol_ani = playKolGroupAnimation()
  });
  // $('.btn2').click();
  // playWaterfallAnimation();

  $('#daniel_waterfall').on('click', 'img', {}, function () {
    // console.log(this)
    var $this = $(this);
    var id = $this.data('id');
    if (!id) {
      return
    }

    $('#popup').fadeIn();
    $('.kol').hide();
    $('.daniel').show();
    daniel.slideTo(id, 0)

  });

  $('#kol_waterfall').on('click', 'img', {}, function () {
    var $this = $(this);
    var id = $this.data('id');
    if (!id) {
      return
    }
    $('#popup').fadeIn();
    $('.daniel').hide();
    $('.kol').show();
    kol.slideTo(id, 0)

  });

  $('.close,.swiper-slide').on('click', function () {
    $('#popup').fadeOut();
  });

  $('.back_home').click(function () {
    $('#daniel_waterfall').hide();
    $('#kol_waterfall').hide();
    $('#body').fadeIn();
    daniel_ani && daniel_ani.kill();
    kol_ani && kol_ani.kill();
  })
  $.smartScroll($('#popup'), '.swiper-container');
  // $('html').addClass('noscroll')
});


function playDanielGroupAnimation() {
  var gridGroup1_1 = $('.gridGroup1-1'),
    gridGroup2_1 = $('.gridGroup2-1'),

    gridGroup1_2 = $('.gridGroup1-2'),
    gridGroup2_2 = $('.gridGroup2-2'),
    gridGroup3_2 = $('.gridGroup3-2'),

    gridGroup1_3 = $('.gridGroup1-3'),
    gridGroup2_3 = $('.gridGroup2-3'),

    gridGroup1_4 = $('.gridGroup1-4'),
    gridGroup2_4 = $('.gridGroup2-4'),
    gridGroup3_4 = $('.gridGroup3-4'),
    gridGroup4_4 = $('.gridGroup4-4'),

    gridGroup1_5 = $('.gridGroup1-5'),
    gridGroup2_5 = $('.gridGroup2-5'),

    gridGroup1_6 = $('.gridGroup1-6'),
    gridGroup2_6 = $('.gridGroup2-6'),

    gridGroup1_7 = $('.gridGroup1-7'),
    gridGroup2_7 = $('.gridGroup2-7'),
    gridGroup3_7 = $('.gridGroup3-7'),

    gridGroup1_8 = $('.gridGroup1-8'),
    gridGroup2_8 = $('.gridGroup2-8')


  ;


  var x = $(window).width() / 2;
  var y = $(window).width() / 2;

  var tl2 = new TimelineLite({
    onComplete: function () {
      tl2.play(0)
    }
  });

  tl2.fromTo(gridGroup1_7, .8, {}, {});
  tl2.fromTo(gridGroup2_7, .8, {x: -x}, {x: 0, delay: 2});
  tl2.fromTo(gridGroup3_7, .8, {x: -x}, {x: 0, delay: 2});

  tl2.fromTo(gridGroup1_8, .8, {x: x}, {x: 0});
  tl2.fromTo(gridGroup2_8, .8, {x: 0}, {x: -x}, '-=0.8');

  tl2.to(gridGroup1_8, .5, {delay: 2, x: -x});
  tl2.to(gridGroup2_8, .5, {delay: 0, x: 0,}, '-=0.5');

  tl2.to(gridGroup3_7, .5, {delay: 1, x: x});
  tl2.to(gridGroup2_7, .5, {delay: 2, x: x});
  tl2.play();


  var tl1 = new TimelineLite({
    onComplete: function () {
      tl1.play(0)
    }
  });
  tl1.fromTo(gridGroup1_1, .8, {x: 0}, {x: x, delay: 2});
  tl1.fromTo(gridGroup2_1, .8, {x: -x}, {x: 0, delay: 0}, '-=.8');

  tl1.fromTo(gridGroup2_2, .8, {x: x}, {x: 0});
  tl1.fromTo(gridGroup3_2, .8, {x: -x}, {x: 0});

  tl1.fromTo(gridGroup2_3, .8, {x: -x}, {x: 0});

  tl1.to(gridGroup2_1, .8, {x: -x});
  tl1.to(gridGroup1_1, .8, {x: 0}, '-=0.8');


  tl1.fromTo(gridGroup1_4, .8, {x: 0}, {x: -x});
  tl1.fromTo(gridGroup2_4, .8, {x: x}, {x: 0}, '-=0.8');
  tl1.fromTo(gridGroup3_4, .8, {x: -x, y: -y}, {x: 0, y: 0});
  tl1.fromTo(gridGroup4_4, .8, {x: x}, {x: 0, delay: 1});

  tl1.fromTo(gridGroup2_5, .8, {x: -x, y: y}, {x: 0, y: 0, delay: 1});

  tl1.fromTo(gridGroup2_6, .8, {x: x}, {x: 0});

  tl1.to(gridGroup3_2, .8, {x: x});
  tl1.to(gridGroup2_2, .8, {x: -x});

  tl1.to(gridGroup2_3, .8, {x: x});

  tl1.to(gridGroup4_4, .8, {x: -x});
  tl1.to(gridGroup3_4, .8, {x: x, y: y});
  tl1.to(gridGroup2_4, .8, {x: x});
  tl1.to(gridGroup1_4, .8, {x: 0}, '-=0.8');

  tl1.to(gridGroup2_5, .8, {x: x, y: -y});

  tl1.to(gridGroup2_6, .8, {x: -x});
  tl1.play();

  function kill() {
    tl1.kill();
    tl2.kill();
  }

  return {
    kill: kill
  }
}

function playKolGroupAnimation() {
  var t = function () {
    return (Math.random() * 8) + 1
  };
  var kolGroup1_1 = $('.kolGroup1-1')
    , kolGroup2_1_b = $('.kolGroup2-1')

    , kolGroup1_2 = $('.kolGroup1-2')
    , kolGroup2_2 = $('.kolGroup2-2')

    , kolGroup1_3 = $('.kolGroup1-3')
    , kolGroup2_3 = $('.kolGroup2-3')
    , kolGroup3_3 = $('.kolGroup3-3')

    , kolGroup1_4_b = $('.kolGroup1-4')
    , kolGroup2_4 = $('.kolGroup2-4')

    , kolGroup1_5 = $('.kolGroup1-5')
    , kolGroup2_5 = $('.kolGroup2-5')

    , kolGroup1_6 = $('.kolGroup1-6')
    , kolGroup2_6_b = $('.kolGroup2-6')

    , kolGroup1_7 = $('.kolGroup1-7')
    , kolGroup2_7 = $('.kolGroup2-7')
    , kolGroup3_7 = $('.kolGroup3-7')

    , kolGroup1_8 = $('.kolGroup1-8')
    , kolGroup2_8_b = $('.kolGroup2-8')

    , kolGroup1_9_b = $('.kolGroup1-9')
    , kolGroup2_9 = $('.kolGroup2-9')

    , kolGroup1_10 = $('.kolGroup1-10')
    , kolGroup2_10 = $('.kolGroup2-10')
    , kolGroup3_10_b = $('.kolGroup3-10')

    , kolGroup1_11 = $('.kolGroup1-11')
    , kolGroup2_11 = $('.kolGroup2-11')

    , kolGroup1_12 = $('.kolGroup1-12')
    , kolGroup2_12 = $('.kolGroup2-12')
    , kolGroup3_12 = $('.kolGroup3-12')

    , kolGroup1_13_b = $('.kolGroup1-13')
    , kolGroup2_13 = $('.kolGroup2-13')
    , kolGroup3_13 = $('.kolGroup3-13')

    , kolGroup1_14 = $('.kolGroup1-14')
    , kolGroup2_14 = $('.kolGroup2-14')

    , kolGroup1_15 = $('.kolGroup1-15')
    , kolGroup2_15 = $('.kolGroup2-15')
    , kolGroup3_15 = $('.kolGroup3-15')

    , kolGroup1_16 = $('.kolGroup1-16')
    , kolGroup2_16 = $('.kolGroup2-16')


    , kolGroup1_17_b = $('.kolGroup1-17')
    , kolGroup2_17 = $('.kolGroup2-17')

    , kolGroup1_18 = $('.kolGroup1-18')
    , kolGroup2_18 = $('.kolGroup2-18')

  ;

  var tl_kolGroup1_1 = new TimelineLite({

      onComplete: function () {
        tl_kolGroup1_1.play(0)
      }
    })
    , tl_kolGroup2_1_b = new TimelineLite({

      onComplete: function () {
        tl_kolGroup2_1_b.play(0)
      }
    })

    , tl_kolGroup1_2 = new TimelineLite({

      onComplete: function () {
        tl_kolGroup1_2.play(0)
      }
    })
    , tl_kolGroup2_2 = new TimelineLite({

      onComplete: function () {
        tl_kolGroup2_2.play(0)
      }
    })

    , tl_kolGroup1_3 = new TimelineLite({

      onComplete: function () {
        tl_kolGroup1_3.play(0)
      }
    })
    , tl_kolGroup2_3 = new TimelineLite({

      onComplete: function () {
        tl_kolGroup2_3.play(0)
      }
    })

    , tl_kolGroup1_4_b = new TimelineLite({

      onComplete: function () {
        tl_kolGroup1_4_b.play(0)
      }
    })
    , tl_kolGroup2_4 = new TimelineLite({

      onComplete: function () {
        tl_kolGroup2_4.play(0)
      }
    })

    , tl_kolGroup1_5 = new TimelineLite({

      onComplete: function () {
        tl_kolGroup1_5.play(0)
      }
    })
    , tl_kolGroup2_5 = new TimelineLite({

      onComplete: function () {
        tl_kolGroup2_5.play(0)
      }
    })

    , tl_kolGroup1_6 = new TimelineLite({

      onComplete: function () {
        tl_kolGroup1_6.play(0)
      }
    })
    , tl_kolGroup2_6_b = new TimelineLite({

      onComplete: function () {
        tl_kolGroup2_6_b.play(0)
      }
    })

    , tl_kolGroup1_7 = new TimelineLite({

      onComplete: function () {
        tl_kolGroup1_7.play(0)
      }
    })
    , tl_kolGroup2_7 = new TimelineLite({

      onComplete: function () {
        tl_kolGroup2_7.play(0)
      }
    })

    , tl_kolGroup1_8 = new TimelineLite({

      onComplete: function () {
        tl_kolGroup1_8.play(0)
      }
    })
    , tl_kolGroup2_8_b = new TimelineLite({

      onComplete: function () {
        tl_kolGroup2_8_b.play(0)
      }
    })

    , tl_kolGroup1_9_b = new TimelineLite({

      onComplete: function () {
        tl_kolGroup1_9_b.play(0)
      }
    })
    , tl_kolGroup2_9 = new TimelineLite({

      onComplete: function () {
        tl_kolGroup2_9.play(0)
      }
    })

    , tl_kolGroup1_10 = new TimelineLite({

      onComplete: function () {
        tl_kolGroup1_10.play(0)
      }
    })
    , tl_kolGroup2_10 = new TimelineLite({

      onComplete: function () {
        tl_kolGroup2_10.play(0)
      }
    })

    , tl_kolGroup1_11 = new TimelineLite({

      onComplete: function () {
        tl_kolGroup1_11.play(0)
      }
    })
    , tl_kolGroup2_11 = new TimelineLite({

      onComplete: function () {
        tl_kolGroup2_11.play(0)
      }
    })

    , tl_kolGroup1_12 = new TimelineLite({

      onComplete: function () {
        tl_kolGroup1_12.play(0)
      }
    })
    , tl_kolGroup2_12 = new TimelineLite({

      onComplete: function () {
        tl_kolGroup2_12.play(0)
      }
    })

    , tl_kolGroup1_13_b = new TimelineLite({

      onComplete: function () {
        tl_kolGroup1_13_b.play(0)
      }
    })
    , tl_kolGroup2_13 = new TimelineLite({

      onComplete: function () {
        tl_kolGroup2_13.play(0)
      }
    })

    , tl_kolGroup1_14 = new TimelineLite({

      onComplete: function () {
        tl_kolGroup1_14.play(0)
      }
    })
    , tl_kolGroup2_14 = new TimelineLite({

      onComplete: function () {
        tl_kolGroup2_14.play(0)
      }
    })

    , tl_kolGroup1_15 = new TimelineLite({

      onComplete: function () {
        tl_kolGroup1_15.play(0)
      }
    })
    , tl_kolGroup2_15 = new TimelineLite({

      onComplete: function () {
        tl_kolGroup2_15.play(0)
      }
    })

    , tl_kolGroup1_16 = new TimelineLite({

      onComplete: function () {
        tl_kolGroup1_16.play(0)
      }
    })
    , tl_kolGroup2_16 = new TimelineLite({

      onComplete: function () {
        tl_kolGroup2_16.play(0)
      }
    })
    , tl_kolGroup1_17_b = new TimelineLite({

      onComplete: function () {
        tl_kolGroup1_17_b.play(0)
      }
    })
    , tl_kolGroup2_17 = new TimelineLite({

      onComplete: function () {
        tl_kolGroup2_17.play(0)
      }
    })

    , tl_kolGroup1_18 = new TimelineLite({

      onComplete: function () {
        tl_kolGroup1_18.play(0)
      }
    })
    , tl_kolGroup2_18 = new TimelineLite({
      onComplete: function () {
        tl_kolGroup2_18.play(0)
      }
    })
  ;

  //1、4
  //1 down
  tl_kolGroup1_1.add(TweenLite.fromTo(kolGroup1_1, 1, {y: '0%'}, {y: '100%', delay: 3}));
  tl_kolGroup2_1_b.add(TweenLite.fromTo(kolGroup2_1_b, 1, {y: '-100%'}, {y: '0%', delay: 3}));
  tl_kolGroup1_1.add(TweenLite.to(kolGroup1_1, 1, {y: '0%', delay: 27}));
  tl_kolGroup2_1_b.add(TweenLite.to(kolGroup2_1_b, 1, {y: '-100%', delay: 27}));


  //4
  tl_kolGroup1_4_b.add(TweenLite.fromTo(kolGroup1_4_b, 1, {y: '0%'}, {y: '-100%', delay: 3}));
  tl_kolGroup2_4.add(TweenLite.fromTo(kolGroup2_4, 1, {y: '100%'}, {y: '0%', delay: 3}));
  tl_kolGroup1_4_b.add(TweenLite.to(kolGroup1_4_b, 1, {y: '0%', delay: 27}));
  tl_kolGroup2_4.add(TweenLite.to(kolGroup2_4, 1, {y: '100%', delay: 27}));

  //8
  tl_kolGroup1_8.add(TweenLite.fromTo(kolGroup1_8, 1, {y: '0%'}, {y: '-100%', delay: 22}));
  tl_kolGroup2_8_b.add(TweenLite.fromTo(kolGroup2_8_b, 1, {y: '100%'}, {y: '0%', delay: 22}));
  tl_kolGroup1_8.add(TweenLite.to(kolGroup1_8, 1, {y: '0%', delay: 32}));
  tl_kolGroup2_8_b.add(TweenLite.to(kolGroup2_8_b, 1, {y: '100%', delay: 32}));

  //9
  tl_kolGroup2_9.add(TweenLite.fromTo(kolGroup1_9_b, 1, {y: '0%'}, {y: '100%', delay: 22}));
  tl_kolGroup1_9_b.add(TweenLite.fromTo(kolGroup2_9, 1, {y: '-100%'}, {y: '0%', delay: 22}));
  tl_kolGroup2_9.add(TweenLite.to(kolGroup1_9_b, 1, {y: '0%', delay: 32}));
  tl_kolGroup1_9_b.add(TweenLite.to(kolGroup2_9, 1, {y: '-100%', delay: 32}));

  //3
  tl_kolGroup1_3.add(TweenLite.fromTo(kolGroup1_3, 1, {y: '0%'}, {y: '100%', delay: 8}));
  tl_kolGroup2_3.add(TweenLite.fromTo(kolGroup2_3, 1, {y: '-100%'}, {y: '0%', delay: 8}));
  tl_kolGroup1_3.add(TweenLite.to(kolGroup1_3, 1, {y: '0%', delay: 47}));
  tl_kolGroup2_3.add(TweenLite.to(kolGroup2_3, 1, {y: '-100%', delay: 47}));


  //7
  tl_kolGroup1_7.add(TweenLite.fromTo(kolGroup1_7, 1, {y: '0%'}, {y: '100%', delay: 22}));
  tl_kolGroup2_7.add(TweenLite.fromTo(kolGroup2_7, 1, {y: '-100%'}, {y: '0%', delay: 22}));
  tl_kolGroup1_7.add(TweenLite.to(kolGroup1_7, 1, {y: '0%', delay: 32 }));
  tl_kolGroup2_7.add(TweenLite.to(kolGroup2_7, 1, {y: '-100%', delay: 32}));


  //2 top
  tl_kolGroup1_2.add(TweenLite.fromTo(kolGroup1_2, 1, {y: '0%'}, {y: '-100%', delay: 12}));
  tl_kolGroup2_2.add(TweenLite.fromTo(kolGroup2_2, 1, {y: '100%'}, {y: '0%', delay: 12}));
  tl_kolGroup1_2.add(TweenLite.to(kolGroup1_2, 1, {y: '0%', delay: 37}));
  tl_kolGroup2_2.add(TweenLite.to(kolGroup2_2, 1, {y: '100%', delay: 37}));


  //5
  tl_kolGroup1_5.add(TweenLite.fromTo(kolGroup1_5, 1, {y: '0%'}, {y: '-100%', delay: 17}));
  tl_kolGroup2_5.add(TweenLite.fromTo(kolGroup2_5, 1, {y: '100%'}, {y: '0%', delay: 17}));
  tl_kolGroup1_5.add(TweenLite.to(kolGroup1_5, 1, {y: '0%', delay: 32}));
  tl_kolGroup2_5.add(TweenLite.to(kolGroup2_5, 1, {y: '100%', delay: 32}));

  //6、8、9
  //6
  tl_kolGroup1_6.add(TweenLite.fromTo(kolGroup1_6, 1, {y: '0%'}, {y: '-100%', delay: 22}));
  tl_kolGroup2_6_b.add(TweenLite.fromTo(kolGroup2_6_b, 1, {y: '100%'}, {y: '0%', delay: 22}));
  tl_kolGroup1_6.add(TweenLite.to(kolGroup1_6, 1, {y: '0%', delay: 32}));
  tl_kolGroup2_6_b.add(TweenLite.to(kolGroup2_6_b, 1, {y: '100%', delay: 32}));


  //10、13
  //10 left
  tl_kolGroup1_10.add(TweenLite.fromTo(kolGroup1_10, 1, {x: '0%'}, {x: '-100%', delay: 27}));
  tl_kolGroup2_10.add(TweenLite.fromTo(kolGroup2_10, 1, {x: '100%'}, {x: '0%', delay: 27}));
  tl_kolGroup1_10.add(TweenLite.to(kolGroup1_10, 1, {x: '0%', delay: 27}));
  tl_kolGroup2_10.add(TweenLite.to(kolGroup2_10, 1, {x: '100%', delay: 27}));


  //13
  tl_kolGroup1_13_b.add(TweenLite.fromTo(kolGroup1_13_b, 1, {x: '0%'}, {x: '100%', delay: 8}));
  tl_kolGroup2_13.add(TweenLite.fromTo(kolGroup2_13, 1, {x: '-100%'}, {x: '0%', delay: 8}));
  tl_kolGroup1_13_b.add(TweenLite.to(kolGroup1_13_b, 1, {x: '0%', delay: 47}));
  tl_kolGroup2_13.add(TweenLite.to(kolGroup2_13, 1, {x: '-100%', delay: 47}));

  //12
  tl_kolGroup1_12.add(TweenLite.fromTo(kolGroup1_12, 1, {x: '0%'}, {x: '-100%', delay: 32}));
  tl_kolGroup2_12.add(TweenLite.fromTo(kolGroup2_12, 1, {x: '100%'}, {x: '0%', delay: 32}));
  tl_kolGroup1_12.add(TweenLite.to(kolGroup1_12, 1, {x: '0%', delay: 27}));
  tl_kolGroup2_12.add(TweenLite.to(kolGroup2_12, 1, {x: '100%', delay: 27}));

  //16
  tl_kolGroup1_16.add(TweenLite.fromTo(kolGroup1_16, 1, {x: '0%'}, {x: '-100%', delay: 32}));
  tl_kolGroup2_16.add(TweenLite.fromTo(kolGroup2_16, 1, {x: '100%'}, {x: '0%', delay: 32}));
  tl_kolGroup1_16.add(TweenLite.to(kolGroup1_16, 1, {x: '0%', delay: 27}));
  tl_kolGroup2_16.add(TweenLite.to(kolGroup2_16, 1,  {x: '100%', delay: 27}));

  //18
  tl_kolGroup1_18.add(TweenLite.fromTo(kolGroup1_18, 1, {x: '0%'}, {x: '-100%', delay: 32}));//32 27
  tl_kolGroup2_18.add(TweenLite.fromTo(kolGroup2_18, 1, {x: '100%'}, {x: '0%', delay: 32}));
  tl_kolGroup1_18.add(TweenLite.to(kolGroup1_18, 1, {x: '0%', delay: 27}));
  tl_kolGroup2_18.add(TweenLite.to(kolGroup2_18, 1, {x: '100%', delay: 27}));


  //11 right
  tl_kolGroup1_11.add(TweenLite.fromTo(kolGroup1_11, 1, {x: '0%'}, {x: '100%', delay: 37}));
  tl_kolGroup2_11.add(TweenLite.fromTo(kolGroup2_11, 1, {x: '-100%'}, {x: '0%', delay: 37}));
  tl_kolGroup1_11.add(TweenLite.to(kolGroup1_11, 1, {x: '0%', delay: 17}));
  tl_kolGroup2_11.add(TweenLite.to(kolGroup2_11, 1, {x: '-100%', delay: 17}));


  //14
  tl_kolGroup1_14.add(TweenLite.fromTo(kolGroup1_14, 1, {x: '0%'}, {x: '100%', delay: 42}));
  tl_kolGroup2_14.add(TweenLite.fromTo(kolGroup2_14, 1, {x: '-100%'}, {x: '0%', delay: 42}));
  tl_kolGroup1_14.add(TweenLite.to(kolGroup1_14, 1, {x: '0%', delay: 12}));
  tl_kolGroup2_14.add(TweenLite.to(kolGroup2_14, 1, {x: '-100%', delay: 12}));

  //15
  tl_kolGroup1_15.add(TweenLite.fromTo(kolGroup1_15, 1, {x: '0%',}, {x: '100%', delay: 47}));
  tl_kolGroup2_15.add(TweenLite.fromTo(kolGroup2_15, 1, {x: '-100%'}, {x: '0%', delay: 47}));
  tl_kolGroup1_15.add(TweenLite.to(kolGroup1_15, 1, {x: '0%', delay: 7}));
  tl_kolGroup2_15.add(TweenLite.to(kolGroup2_15, 1, {x: '-100%', delay: 7}));

  //17
  tl_kolGroup1_17_b.add(TweenLite.fromTo(kolGroup1_17_b, 1, {x: '0%'}, {x: '100%', delay: 47}));
  tl_kolGroup2_17.add(TweenLite.fromTo(kolGroup2_17, 1, {x: '-100%'}, {x: '0%', delay: 47}));
  tl_kolGroup1_17_b.add(TweenLite.to(kolGroup1_17_b, 1, {x: '0%', delay: 7}));
  tl_kolGroup2_17.add(TweenLite.to(kolGroup2_17, 1, {x: '-100%', delay: 7}));

  function kill() {
    tl_kolGroup1_1.kill();
    tl_kolGroup2_1_b.kill();
    tl_kolGroup1_2.kill();
    tl_kolGroup2_2.kill();
    tl_kolGroup1_3.kill();
    tl_kolGroup2_3.kill();
    tl_kolGroup1_4_b.kill();
    tl_kolGroup2_4.kill();
    tl_kolGroup1_5.kill();
    tl_kolGroup2_5.kill();
    tl_kolGroup1_6.kill();
    tl_kolGroup2_6_b.kill();
    tl_kolGroup1_7.kill();
    tl_kolGroup2_7.kill();
    tl_kolGroup1_8.kill();
    tl_kolGroup2_8_b.kill();
    tl_kolGroup1_9_b.kill();
    tl_kolGroup2_9.kill();
    tl_kolGroup1_10.kill();
    tl_kolGroup2_10.kill();
    tl_kolGroup1_11.kill();
    tl_kolGroup2_11.kill();
    tl_kolGroup1_12.kill();
    tl_kolGroup2_12.kill();
    tl_kolGroup1_13_b.kill();
    tl_kolGroup2_13.kill();
    tl_kolGroup1_14.kill();
    tl_kolGroup2_14.kill();
    tl_kolGroup1_15.kill();
    tl_kolGroup2_15.kill();
    tl_kolGroup1_16.kill();
    tl_kolGroup2_16.kill();
    tl_kolGroup1_17_b.kill();
    tl_kolGroup2_17.kill();
    tl_kolGroup1_18.kill();
    tl_kolGroup2_18.kill()
  }

  return {
    kill: kill
  }
}

//这个是调用微信图片浏览器的函数
function imagePreview(curSrc, srcList) {
  if (!curSrc || !srcList || srcList.length === 0) {
    return;
  }
  WeixinJSBridge.invoke('imagePreview', {
    'current': curSrc,
    'urls': srcList
  });
}

(function ($) {
  var aa = [];
  var i = 0;
  var src = [];
  var json = null;
  aa = $('.pro');
  for (i = 0; i < aa.length; i++) {
    src[i] = aa[i].src;  //把所有的src存到数组里
  }
  var srcList = JSON.stringify(src); //转换成json并赋值给srcList
  console.log(src, srcList)
  $('.pro').click(function () {
    imagePreview(this.src, src);
  });
})(jQuery);


//web移动端浮层滚动阻止window窗体滚动JS/CSS处理
$.smartScroll = function (container, selectorScrollable) {
  // 如果没有滚动容器选择器，或者已经绑定了滚动时间，忽略
  if (!selectorScrollable || container.data('isBindScroll')) {
    return;
  }

  // 是否是搓浏览器
  // 自己在这里添加判断和筛选
  var isSBBrowser;

  var data = {
    posY: 0,
    maxscroll: 0
  };

  // 事件处理
  container.on({
    touchstart: function () {

      var events = event.touches[0] || event;

      // 先求得是不是滚动元素或者滚动元素的子元素
      var elTarget = $(event.target);

      if (!elTarget.length) {
        return;
      }

      var elScroll;

      // 获取标记的滚动元素，自身或子元素皆可
      if (elTarget.is(selectorScrollable)) {
        elScroll = elTarget;
      } else if ((elScroll = elTarget.parents(selectorScrollable)).length === 0) {
        elScroll = null;
      }

      if (!elScroll) {
        return;
      }

      // 当前滚动元素标记
      data.elScroll = elScroll;

      // 垂直位置标记
      data.posY = events.pageY;
      data.scrollY = elScroll.scrollTop();
      // 是否可以滚动
      data.maxscroll = elScroll[0].scrollHeight - elScroll[0].clientHeight;
    },
    touchmove: function () {
      // 如果不足于滚动，则禁止触发整个窗体元素的滚动
      if (data.maxscroll <= 0 || isSBBrowser) {
        // 禁止滚动
        event.preventDefault();
        return;
      }
      // 滚动元素
      var elScroll = data.elScroll;
      // 当前的滚动高度
      var scrollTop = elScroll.scrollTop();

      // 现在移动的垂直位置，用来判断是往上移动还是往下
      var events = event.touches[0] || event;
      // 移动距离
      var distanceY = events.pageY - data.posY;

      if (isSBBrowser) {
        elScroll.scrollTop(data.scrollY - distanceY);
        elScroll.trigger('scroll');
        return;
      }

      // 上下边缘检测
      if (distanceY > 0 && scrollTop === 0) {
        // 往上滑，并且到头
        // 禁止滚动的默认行为
        event.preventDefault();
        return;
      }

      // 下边缘检测
      if (distanceY < 0 && (scrollTop + 1 >= data.maxscroll)) {
        // 往下滑，并且到头
        // 禁止滚动的默认行为
        event.preventDefault();
        return;
      }
    },
    touchend: function () {
      data.maxscroll = 0;
    }
  });

  // 防止多次重复绑定
  container.data('isBindScroll', true);
};

$.ajax({
  url: 'http://h5.descente-china.com.cn/weChat/weChatApi.php',
  type: 'POST',
  async: true,
  data: {url: location.href.split('#')[0]},
  dataType: 'json',
  cache: false,
  success: function (data) {
    wx.config({
      debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来，若要查看传入的参数，可以在pc端打开，参数信息会通过log打出，仅在pc端时才会打印。
      appId: data['appId'], // 必填，公众号的唯一标识
      timestamp: data['timestamp'], // 必填，生成签名的时间戳
      nonceStr: data['nonceStr'], // 必填，生成签名的随机串
      signature: data['signature'],// 必填，签名
      jsApiList: ['checkJsApi', 'updateAppMessageShareData', 'updateTimelineShareData', 'onMenuShareAppMessage', 'onMenuShareTimeline', 'onMenuShareQQ', 'onMenuShareWeibo', 'onMenuShareQZone'] // 必填，需要使用的JS接口列表
    });


    wx.ready(function () {   //需在用户可能点击分享按钮前就先调用

      wx.checkJsApi({
        jsApiList: ['updateAppMessageShareData', 'updateTimelineShareData', 'onMenuShareAppMessage', 'onMenuShareTimeline', 'onMenuShareQQ', 'onMenuShareWeibo', 'onMenuShareQZone'], // 需要检测的JS接口列表，所有JS接口列表见附录2,
        success: function (res) {
          // 以键值对的形式返回，可用的api值true，不可用为false
          // 如：{"checkResult":{"chooseImage":true},"errMsg":"checkJsApi:ok"}
          // alert(JSON.stringify(res));
        }
      });

      wx.updateAppMessageShareData(shareData, function (res) {
//这里是回调函数
      });

      wx.updateTimelineShareData(shareData, function (res) {
//这里是回调函数
      });

      wx.onMenuShareAppMessage(shareData, function (res) {
//这里是回调函数
      });

      wx.onMenuShareTimeline(shareData, function (res) {
//这里是回调函数
      });
      wx.onMenuShareQQ(shareData, function (res) {
//这里是回调函数
      });
      wx.onMenuShareWeibo(shareData, function (res) {
//这里是回调函数
      });
      wx.onMenuShareQZone(shareData, function (res) {
//这里是回调函数
      });
    });

  }
});

